package com.spring.aspects;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

@Aspect
public class LogginAspect {
	
	/*@Before("execution(* com.spring.aop.HelloWorld.*(..))")
	public void logBefore(JoinPoint joinPoint) { 
		System.out.print("@Before Advivce ");
		System.out.println( joinPoint.getSignature().getName());
		
	}*/
	
	/*@After("execution(* com.spring.aop.HelloWorld.*(..))")
	public void logAfter(JoinPoint joinPoint) { 
		System.out.print("@After Advice");
		System.out.println( joinPoint.getSignature().getName());		
	}*/
	
	

	@Around("execution(* com.spring.aop.HelloWorld.*(..))")
	public Object logAround(ProceedingJoinPoint  joinPoint) throws Throwable{
		System.out.print("@Around before");
		System.out.println( joinPoint.getSignature().getName());
		Object obj = joinPoint.proceed();
		System.out.print("@Around after");
		System.out.println( joinPoint.getSignature().getName());
		return obj;
	}
}
